<template>
  <div class="backView">
    <p class="nameLabel">统计维度</p>

    <div class="typeView">
      <div :class="type === 0 ? 'typeSingleView typeSelected' : 'typeSingleView typeNormal'" @click="change(0)">成员</div>
      <div :class="type === 1 ? 'typeSingleView typeSelected' : 'typeSingleView typeNormal'" @click="change(1)">门店</div>
    </div>

  </div>
</template>

<script>

  export default {
    name: "ChartTypeView",
    data() {
      return{
        type: 0
      }
    },
    methods: {
      change(e) {

        if (e === this.type) {
          return
        }
        this.type = e
        this.$emit("sendTypeChange", e)
      },

    }
  }
</script>

<style scoped>
  .backView {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 16px;
    height: 48px;
    background-color: white;
  }
  .nameLabel {
    font-size: 16px;
    font-weight: bold;
  }
  .typeView{
    display: flex;
    border-radius: 12px;
    border: #1DA1F2 1px solid;
    overflow: hidden;
  }
  .typeSingleView {
    height: 24px;
    width: 44px;
    text-align: center;
    font-size: 12px;
    line-height: 24px;

  }
  .typeNormal {
    background-color: white;
    color: #1DA1F2;
  }
  .typeSelected {
    background-color: #1DA1F2;
    color: white;
  }

</style>



